<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>佐心，教家长做父母</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="assets/css/amazeui.min.css">
    <link rel="stylesheet" href="assets/css/style.css?v=2.3">
    <link rel="stylesheet" href="assets/css/index.css?v=2.3">
    <link rel="stylesheet"  href="assets/css/menu.css?v=2.3">
    <link rel="stylesheet"  href="assets/css/service_market.css?v=2.3">
    <script>
    	
    	var cityName_="";
    	var goodDirection_="";
    	var counseType_="";
    	var txtsearch_="";
    	var sort_="";
    </script>
    <script>
    	    /** 
     * 返回前一页（或关闭本页面） 
     * <li>如果没有前一页历史，则直接关闭当前页面</li> 
     */  
    function goBack(){  
        if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)){ // IE  
            if(history.length > 0){  
                window.history.go( -1 );  
            }else{  
                location.href="${ctx}/index.jsp";
            }  
        }else{ //非IE浏览器  
            if (navigator.userAgent.indexOf('Firefox') >= 0 ||  
                navigator.userAgent.indexOf('Opera') >= 0 ||  
                navigator.userAgent.indexOf('Safari') >= 0 ||  
                navigator.userAgent.indexOf('Chrome') >= 0 ||  
                navigator.userAgent.indexOf('WebKit') >= 0){  
      
                if(window.history.length > 1){  
                    window.history.go( -1 );  
                }else{  
                    location.href="${ctx}/index.jsp";
                }  
            }else{ //未知的浏览器  
                window.history.go( -1 );  
            }  
        }  
    }  
    </script>
</head>
<body class="bg-gray">

<header data-am-widget="header" class="am-header am-header-default am-header-fixed">
    <div class="am-header-left am-header-nav">
       <a  onclick="goBack();"  >
            <i class="icon_8"></i>
        </a>
    </div>
    <h1 class="am-header-title margin-10s">
        <div class="search">
            <input type="text" id="txtsearch" placeholder="请输入关键字搜索">
            <!-- <i class="icon_14 am-hide"></i> -->
        </div>
    </h1>
    <div class="am-header-right am-header-nav">
        <a class="widht-10s">
            <i id="soso" class="icon_121"></i>
        </a>
    </div>

</header>

<section class="am-padding-bottom-sm am-padding-bottom-xl am-margin-bottom-sm" id="amz-main" data-tag="css-nav">


    <div class="am-g  am-g-collapse expert_tabs bg-white am-text-center border-bottom padding-top-bottom-10 tab-fixed">
        <div class="am-u-sm-3 "> <span  class="prelative padding-left-fu20px" onclick="$('#my-popup').modal('open')"><span id="span_city">城市</span><i class="am-icon-angle-down"></i>
        </span></div>
        <div class="am-u-sm-3 "> <a  class="prelative padding-left-fu20px" id="secure_type"><span id="fs1">咨询领域</span><i class="am-icon-angle-down"></i>
        </a></div>
        <div class="am-u-sm-3 "><a class="prelative padding-left-fu20px" id="secure_price"><span id="fs2">咨询方式</span><i class="am-icon-angle-down"></i></a></div>
        <div class="am-u-sm-3"><a id="sort_price" class="prelative padding-left-fu20px">价格<span class="icon-sort"></span></a></div>
    </div>

    <!--咨询领域-->
    <div class="filter-container" data-node="secure_type">
        <ul class="list-group">
            <li class="fis-filter-item selected"><a>全部</a><i></i></li>
            <li class="fis-filter-item "><a>学业倦怠</a><i></i></li>
            <li class="fis-filter-item "><a>亲子关系</a><i></i></li>
            <li class="fis-filter-item "><a>教育理念</a><i></i></li>
            <li class="fis-filter-item "><a>学习习惯</a><i></i></li>
            <li class="fis-filter-item "><a>人际关系</a><i></i></li>
            <li class="fis-filter-item "><a>沉迷网络</a><i></i></li>
            <li class="fis-filter-item "><a>情绪管理</a><i></i></li>
            <li class="fis-filter-item "><a>自控能力</a><i></i></li>
            <li class="fis-filter-item "><a>其他</a><i></i></li>
        </ul>
    </div>

    <!--咨询方式-->
    <div class="filter-container" data-node="secure_price">
        <ul class="list-group">
            <li class="fis-filter-item selected"><a>全部</a> <i></i></li>
            <li class="fis-filter-item "><a>视频咨询</a><i></i></li>
            <li class="fis-filter-item "><a>电话咨询</a><i></i></li>
            <li class="fis-filter-item "><a>面对面咨询</a><i></i></li>
        </ul>
    </div>
    <div class="global-mask"></div>

    <div  class="am-list-news am-list-news-default expert_list margin-top-43">
        <div class="am-list-news-bd ">
            <ul class="am-list am-padding-left-sm bg-white border-bottom">
               
            </ul>
        </div>
    </div>
</section>

<!--选择城市-->
<div class="am-popup" id="my-popup">
    <div class="am-popup-inner">

        <header data-am-widget="header" class="am-header am-header-default am-header-fixed ">
            <div class="am-header-left am-header-nav">
                <a class="" data-am-modal-close>
                    <!--更新-->
                    <i class="icon_8"></i>
                </a>
            </div>
            <h1 class="am-header-title">
                选择城市
            </h1>

        </header>

        <section class="" >
            <div class="">
                <ul class="list-group">
                    <li class="fis-filter-item letter"><a>当前</a> <i></i></li>
                    <li class="fis-filter-item "><a>${cityName}</a><span class="font-gray-1 font-14">（GPS定位）</span> <i></i></li>
                    <li class="fis-filter-item letter"><a>选择其他城市</a> <i></i></li>
                </ul>
                <ul class="list-group" id="cityList" data-node="city">
                    <li class="fis-filter-item selected" data-am-modal-close><a>厦门市</a> <i></i></li>
                    <li class="fis-filter-item " data-am-modal-close><a>福州市</a> <i></i></li>
                    <li class="fis-filter-item " data-am-modal-close><a>泉州市</a> <i></i></li>
                    <li class="fis-filter-item " data-am-modal-close><a>深圳市</a> <i></i></li>
                </ul>


            </div>


        </section>
    </div>
</div>
<footer data-am-widget="navbar" class="am-navbar am-cf am-navbar-default "
        id="">
    <ul class="am-navbar-nav am-cf am-avg-sm-4">
        <li>
            <a href="index.jsp">
                <img src="assets/images/icon/index/icon_home.png"
                     alt="首页"/>
                <span class="am-navbar-label">首页</span>
            </a>
        </li>
        <li>
            <a href="counseKu.jsp" class="selected">
                <img src="assets/images/icon/index/icon_zhuanjia_on.png"
                     alt="专家库"/>
                <span class="am-navbar-label">专家库</span>
            </a>
        </li>

        <li>
            <a href="peixun.jsp" class="">
                <img src="assets/images/icon/index/icon_peixun.png"
                     alt="培训"/>
                <span class="am-navbar-label">培训</span>
            </a>
        </li>
        <li>
            <a href="myzones.jsp" class="">
                <img src="assets/images/icon/index/icon_user.png"
                     alt="我的"/>
                <span class="am-navbar-label" onclick="goMe();">我的</span>
            </a>
        </li>
    </ul>
</footer>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/amazeui.min.js"></script>
<script>
	
	function goCounselor(tel){
        location.href="gotoCounselorDescjsp?tel="+tel;
    };

    $(function () {
    
    	var cityLists=$.ajax({url:"getCityList",async:false});
        var cityList=JSON.parse(cityLists.responseText);
        if(cityList.resultCode=="0"){
        	var cityListHtml="";
        	   for(var i=0;i<cityList.cityNameList.length;i++){
	               cityListHtml+="<li class='fis-filter-item ' data-am-modal-close><a>"+cityList.cityNameList[i].cityName+"市</a> <i></i></li>";
               };
               $("#cityList").html(cityListHtml);
        }
    
    	var counselorList="";
    	if("noshuju"=='${param.txtsearch}'){
    		goodDirection_='${param.type_}';
    		counselorList=$.ajax({url:"getCounseList?goodDirection="+goodDirection_,async:false});
    	}else if(""!='${param.txtsearch}'){
    		txtsearch_='${param.txtsearch}';
    		counselorList=$.ajax({url:"getCounseList?txtsearch="+txtsearch_,async:false});
    	}else{
    		counselorList=$.ajax({url:"getCounseList",async:false});
    	}
    	
        var jsonCounselor=JSON.parse(counselorList.responseText);
        if(jsonCounselor.resultCode=="0"){
        		var html="";
        		for(var i=0;i<jsonCounselor.counselor.length;i++){
        			
        			html+="<li onclick='goCounselor("+jsonCounselor.counselor[i].counseTel+")' class='am-g am-list-item-desced am-list-item-thumbed '>";
                        html+="<div class=' am-u-sm-12 am-list-main box '>";
                        html+="<div class='width-75px'>";
                        html+="<a class=''>";
                        html+="<img class='img-65' src='"+jsonCounselor.counselor[i].personHead+"'/>";
                        html+="</a>";
                    html+="</div>";
                    html+="<div class='box-1'>";
                        html+="<h3 class='am-list-item-hd font-color-main'>";
						if(jsonCounselor.counselor[i].recommenGrade.length==1){
                        	html+=" "+jsonCounselor.counselor[i].counseName+" <span style='float:right;margin-right:5%;color:#49B7B7'>推荐指数:0"+jsonCounselor.counselor[i].recommenGrade+"</span>";
                        }else{
                           html+=" "+jsonCounselor.counselor[i].counseName+" <span style='float:right;margin-right:5%;color:#49B7B7'>推荐指数:"+jsonCounselor.counselor[i].recommenGrade+"</span>";
                       	}                       html+=" </h3>";

                       html+=" <div class='font-12  font-color-11'>";
                       //alert(jsonCounselor.counselor[i].professional);
                       //if(jsonCounselor.counselor[i].professional.length>70){
                       //		var counseTemps=jsonCounselor.counselor[i].professional;
                       //		var firstStr=counseTemps.substr(0,70);
                       		//html+=""+firstStr+"...";
                       //		 html+=""+jsonCounselor.counselor[i].professional;
                       //}else{
                         html+=""+jsonCounselor.counselor[i].professional;
                       //}
                       html+=" </div>";
                       html+=" <div class='font-14  font-color-main'>";
                       html+=" 擅长方向： "+jsonCounselor.counselor[i].goodDirection;
                       html+=" </div>";
                    html+="</div>";
                    html+="</div>";
               html+=" </li>";
        		}
        		$(".am-list").html(html);
        }
    
        $(".expert_tabs a").click(function () {
            if ($("[data-node='" + $(this).attr("id") + "']").is(":hidden")) {
                $(".filter-container").hide();
                $(".global-mask").hide();
                $("[data-node='" + $(this).attr("id") + "']").show();
                $(".global-mask").show();
            }
            else {
                $(".filter-container").hide();
                $(".global-mask").hide();
            }
        });
        $(".global-mask").click(function () {
            $(".filter-container").hide();
            $(".global-mask").hide();
        });

        $(".expert_tabs a").each(function () {
            var id = $(this).attr("id");
            $("[data-node='" + id + "']").find(".list-group li").click(function () {
                if (!$(this).hasClass('letter')) {

                    $("[data-node='" + id + "']").find(".list-group li").removeClass("selected");
                    $(this).addClass("selected");
                    $(".filter-container").hide();
                    $(".global-mask").hide();
                    var text =$(this).text();
                   	var cans="1=1";
                   	if(text=="全部"){
                   		 goodDirection_="";
                   		 $("#fs1").text("咨询领域");
                   		 if(""!=counseType_){
                    		cans+="&counseType="+counseType_;
                    	 }
                   	}else if(text=="全部 "){
                   	 $("#fs2").text("咨询方式");
                   		counseType_="";
                   		if(""!=goodDirection_){
                    		cans+="&goodDirection="+goodDirection_;
                    	}
                   	}else if(text=="视频咨询" || text=="电话咨询" || text=="面对面咨询"){
                   	 $("#fs2").text(text);
                   		cans="&counseType="+text;
                   		counseType_=text;
                   		
                   		if(""!=goodDirection_){
                    		cans+="&goodDirection="+goodDirection_;
                    	}
                   	}else{
                   	 $("#fs1").text(text);
                   		cans="&goodDirection="+text;
                   		goodDirection_=text;
                   		
                   		if(""!=counseType_){
                    		cans+="&counseType="+counseType_;
                    	}
                   		
                   	}
                   	
                    if(""!=cityName_){
                    	cans+="&cityName="+cityName_;
                    }
                    if(""!=sort_){
                	 	cans+="&sort="+sort_;
            		}
            		if(txtsearch_!=""){
          	    		cans+="&txtsearch="+txtsearch_;
          			}
                    
                    var counselorList=$.ajax({url:"getCounseList?"+cans,async:false});
            var jsonCounselor=JSON.parse(counselorList.responseText);
            if(jsonCounselor.resultCode=="0"){
        		var html="";
        		for(var i=0;i<jsonCounselor.counselor.length;i++){
        			
        			html+="<li onclick='goCounselor("+jsonCounselor.counselor[i].counseTel+")' class='am-g am-list-item-desced am-list-item-thumbed '>";
                        html+="<div class=' am-u-sm-12 am-list-main box '>";
                        html+="<div class='width-75px'>";
                        html+="<a class=''>";
                        html+="<img class='img-65' src='"+jsonCounselor.counselor[i].personHead+"'/>";
                        html+="</a>";
                    html+="</div>";
                    html+="<div class='box-1'>";
                        html+="<h3 class='am-list-item-hd font-color-main'>";
						if(jsonCounselor.counselor[i].recommenGrade.length==1){
                        	html+=" "+jsonCounselor.counselor[i].counseName+" <span style='float:right;margin-right:5%;color:#49B7B7'>推荐指数:0"+jsonCounselor.counselor[i].recommenGrade+"</span>";
                        }else{
                           html+=" "+jsonCounselor.counselor[i].counseName+" <span style='float:right;margin-right:5%;color:#49B7B7'>推荐指数:"+jsonCounselor.counselor[i].recommenGrade+"</span>";
                       	}                       html+=" </h3>";

                       html+=" <div class='font-12  font-color-11'>";
                            html+=""+jsonCounselor.counselor[i].professional;
                       html+=" </div>";
                       html+=" <div class='font-14  font-color-main'>";
                       html+=" 擅长方向： "+jsonCounselor.counselor[i].goodDirection;
                       html+=" </div>";
                    html+="</div>";
                    html+="</div>";
               html+=" </li>";
        		}
        		$(".am-list").html(html);
          }
                    
                } else {
                    alert('再瞎点遭雷劈！' + "\n注释：这个地方不用调取接口！！！");
                }
            });
        });

        $("#sort_price").click(function () {
        	var cans3="";
            if ($(this).find(".icon-sort").hasClass("cur")) {
                $(this).find(".icon-sort").removeClass("cur");
                cans3="sort=0";
                sort_="0";
            }else{
                $(this).find(".icon-sort").addClass("cur");
                cans3="sort=1";
                sort_="1";
            }
           	if(""!=counseType_){
                cans3+="&counseType="+counseType_;
          	}
           
           	if(""!=goodDirection_){
                cans3+="&goodDirection="+goodDirection_;
          	}
           	if(""!=cityName_){
                cans3+="&cityName="+cityName_;
          	}
          	if(txtsearch_!=""){
          	    cans3+="&txtsearch="+txtsearch_;
          	}
           	
           	var counselorList=$.ajax({url:"getCounseList?"+cans3,async:false});
            var jsonCounselor=JSON.parse(counselorList.responseText);
            if(jsonCounselor.resultCode=="0"){
        		var html="";
        		for(var i=0;i<jsonCounselor.counselor.length;i++){
        			
        			html+="<li onclick='goCounselor("+jsonCounselor.counselor[i].counseTel+")' class='am-g am-list-item-desced am-list-item-thumbed '>";
                        html+="<div class=' am-u-sm-12 am-list-main box '>";
                        html+="<div class='width-75px'>";
                        html+="<a class=''>";
                        html+="<img class='img-65' src='"+jsonCounselor.counselor[i].personHead+"'/>";
                        html+="</a>";
                    html+="</div>";
                    html+="<div class='box-1'>";
                        html+="<h3 class='am-list-item-hd font-color-main'>";
						if(jsonCounselor.counselor[i].recommenGrade.length==1){
                        	html+=" "+jsonCounselor.counselor[i].counseName+" <span style='float:right;margin-right:5%;color:#49B7B7'>推荐指数:0"+jsonCounselor.counselor[i].recommenGrade+"</span>";
                        }else{
                           html+=" "+jsonCounselor.counselor[i].counseName+" <span style='float:right;margin-right:5%;color:#49B7B7'>推荐指数:"+jsonCounselor.counselor[i].recommenGrade+"</span>";
                       	}                       html+=" </h3>";

                       html+=" <div class='font-12  font-color-11'>";
                            html+=""+jsonCounselor.counselor[i].professional;
                       html+=" </div>";
                       html+=" <div class='font-14  font-color-main'>";
                       html+=" 擅长方向： "+jsonCounselor.counselor[i].goodDirection;
                       html+=" </div>";
                    html+="</div>";
                    html+="</div>";
               html+=" </li>";
        		}
        		$(".am-list").html(html);
          }	
           		
            	
        });

		$("#soso").click(function () {
			
			txtsearch_=$("#txtsearch").val();
			var cans4="";
			if(txtsearch_!=""){
				cans4="txtsearch="+txtsearch_;
		
				if(""!=counseType_){
	                 cans4+="&counseType="+counseType_;
	           	}
	            
	            if(""!=goodDirection_){
	                 cans4+="&goodDirection="+goodDirection_;
	           	}
	            if(""!=cityName_){
	                 cans4+="&cityName="+cityName_;
	           	}
	           	if(""!=sort_){
                	 cans4+="&sort="+sort_;
            	}
	        } else{
	        	cans4="1=1";
		
				if(""!=counseType_){
	                 cans4+="&counseType="+counseType_;
	           	}
	            
	            if(""!=goodDirection_){
	                 cans4+="&goodDirection="+goodDirection_;
	           	}
	            if(""!=cityName_){
	                 cans4+="&cityName="+cityName_;
	           	}
	           	if(""!=sort_){
                	 cans4+="&sort="+sort_;
            	}
	        } 	
	           	
	        var counselorList=$.ajax({url:"getCounseList?"+cans4,async:false});
            var jsonCounselor=JSON.parse(counselorList.responseText);
            if(jsonCounselor.resultCode=="0"){
        		var html="";
        		for(var i=0;i<jsonCounselor.counselor.length;i++){
        			
        			html+="<li onclick='goCounselor("+jsonCounselor.counselor[i].counseTel+")' class='am-g am-list-item-desced am-list-item-thumbed '>";
                        html+="<div class=' am-u-sm-12 am-list-main box '>";
                        html+="<div class='width-75px'>";
                        html+="<a class=''>";
                        html+="<img class='img-65' src='"+jsonCounselor.counselor[i].personHead+"'/>";
                        html+="</a>";
                    html+="</div>";
                    html+="<div class='box-1'>";
                        html+="<h3 class='am-list-item-hd font-color-main'>";
						if(jsonCounselor.counselor[i].recommenGrade.length==1){
                        	html+=" "+jsonCounselor.counselor[i].counseName+" <span style='float:right;margin-right:5%;color:#49B7B7'>推荐指数:0"+jsonCounselor.counselor[i].recommenGrade+"</span>";
                        }else{
                           html+=" "+jsonCounselor.counselor[i].counseName+" <span style='float:right;margin-right:5%;color:#49B7B7'>推荐指数:"+jsonCounselor.counselor[i].recommenGrade+"</span>";
                       	}                       html+=" </h3>";

                       html+=" <div class='font-12  font-color-11'>";
                            html+=""+jsonCounselor.counselor[i].professional;
                       html+=" </div>";
                       html+=" <div class='font-14  font-color-main'>";
                       html+=" 擅长方向： "+jsonCounselor.counselor[i].goodDirection;
                       html+=" </div>";
                    html+="</div>";
                    html+="</div>";
               html+=" </li>";
        		}
        		$(".am-list").html(html);
			}
		});

        $("#txtsearch").on("keyup",function(){
            if($(this).val()==""){
                $(".icon_14").addClass("am-hide");
            }else{
                $(".icon_14").removeClass("am-hide");
            }
        });
    });
</script>
<script>
    $(function () {
        // 城市选择
        $("[data-node='city']").find(" li").click(function () {
            $("[data-node='city']").find(" li").removeClass("selected");
            $(this).addClass("selected");
            $("#span_city").text($(this).text().substring(0, 2));
            var cityName=$(this).text().substring(0, 2);
            
            var cans2="cityName="+cityName;
            
            if(""!=counseType_){
                cans2+="&counseType="+counseType_;
            }
            
            if(""!=goodDirection_){
                cans2+="&goodDirection="+goodDirection_;
            }
            if(""!=sort_){
                cans2+="&sort="+sort_;
            }
            if(""!=txtsearch_){
                cans2+="&txtsearch="+txtsearch_;
            }
            
            
            cityName_=cityName;
            var counselorList=$.ajax({url:"getCounseList?"+cans2,async:false});
            var jsonCounselor=JSON.parse(counselorList.responseText);
            if(jsonCounselor.resultCode=="0"){
        		var html="";
        		for(var i=0;i<jsonCounselor.counselor.length;i++){
        			//counselorDesc.jsp?tel=18850987678
        			html+="<li onclick='goCounselor("+jsonCounselor.counselor[i].counseTel+")' class='am-g am-list-item-desced am-list-item-thumbed '>";
                        html+="<div class=' am-u-sm-12 am-list-main box '>";
                        html+="<div class='width-75px'>";
                        html+="<a class=''>";
                        html+="<img class='img-65' src='"+jsonCounselor.counselor[i].personHead+"'/>";
                        html+="</a>";
                    html+="</div>";
                    html+="<div class='box-1'>";
                        html+="<h3 class='am-list-item-hd font-color-main'>";
						if(jsonCounselor.counselor[i].recommenGrade.length==1){
                        	html+=" "+jsonCounselor.counselor[i].counseName+" <span style='float:right;margin-right:5%;color:#49B7B7'>推荐指数:0"+jsonCounselor.counselor[i].recommenGrade+"</span>";
                        }else{
                           html+=" "+jsonCounselor.counselor[i].counseName+" <span style='float:right;margin-right:5%;color:#49B7B7'>推荐指数:"+jsonCounselor.counselor[i].recommenGrade+"</span>";
                       	}                       html+=" </h3>";

                       html+=" <div class='font-12  font-color-11'>";
                            html+=""+jsonCounselor.counselor[i].professional;
                       html+=" </div>";
                       html+=" <div class='font-14  font-color-main'>";
                       html+=" 擅长方向： "+jsonCounselor.counselor[i].goodDirection;
                       html+=" </div>";
                    html+="</div>";
                    html+="</div>";
               html+=" </li>";
        		}
        		$(".am-list").html(html);
          }
          });
    });
</script>
</body>
</html>